<?php
	function knek2Products(){
		$host = "gator3109.hostgator.com";
		$db_username = "worldcl7_WG101re";
		$db_password = "usr_868686";
		$database = "worldcl7_WG101Registration";	
		$knek2_RDMS = mysqli_connect($host, $db_username, $db_password, $database);
		mysqli_query($knek2_RDMS, "SET NAMES utf8");
		mysqli_query($knek2_RDMS, "SET CHARACTER SET utf8");		
		if(mysqli_connect_errno()) die ('Cannot connect to MySQL.');
		return $knek2_RDMS;
	}
	function insertInfo(){
		$knek = knek2Products();
		$email = mysqli_real_escape_string($knek, $_POST['email']);
		$date = $dtime = date('Y-m-d h-i-s', mktime());
		$command = "INSERT INTO registrants (reg_id, email, date) VALUES ('', '".$email."', '".$date."')";
		$process = mysqli_query($knek, $command);
		if(!$process || mysqli_error($knek))
			die('There was a problem registering your info, please try again!');
		else
			echo 'That\'s it, you\'re done! Thank you for registering';
	}
	insertInfo();
?>